// ABMNZN SDK 2018-02-08-63k6q26l if (window.amazon == null || window.amazon.Login == null) { (function() { 'use strict';var f=void 0,g=!0,h=null,i=!1;function k(a){return function(){return this[a]}}var l,p,q,r,t,aa;function ba(a,b){if(a===h||a===f)a={};for(var c=1;c=A;)a+=A,C();if("."===A)for(a+=".";C()&&"0"<=A&&"9">=A;)a+=A;if("e"===A||"E"===A){a+=A;C();if("-"===A||"+"===A)a+=A,C();for(;"0"<=A&&"9">=A;)a+=A,C()}a=+a;if(isFinite(a))return a;B("Bad number")} function ia(){var a,b,c="",d;if('"'===A)for(;C();){if('"'===A)return C(),c;if("\\"===A)if(C(),"u"===A){for(b=d=0;4>b;b+=1){a=parseInt(C(),16);if(!isFinite(a))break;d=16*d+a}c+=String.fromCharCode(d)}else if("string"===typeof fa[A])c+=fa[A];else break;else c+=A}B("Bad string")}function D(){for(;A&&" ">=A;)C()} function ja(){switch(A){case "t":return C("t"),C("r"),C("u"),C("e"),g;case "f":return C("f"),C("a"),C("l"),C("s"),C("e"),i;case "n":return C("n"),C("u"),C("l"),C("l"),h}B("Unexpected '"+A+"'")}var E; E=function(){D();switch(A){case "{":var a;a:{var b={};if("{"===A){C("{");D();if("}"===A){C("}");a=b;break a}for(;A;){a=ia();D();C(":");Object.hasOwnProperty.call(b,a)&&B('Duplicate key "'+a+'"');b[a]=E();D();if("}"===A){C("}");a=b;break a}C(",");D()}}B("Bad object");a=f}return a;case "[":a:{a=[];if("["===A){C("[");D();if("]"===A){C("]");break a}for(;A;){a.push(E());D();if("]"===A){C("]");break a}C(",");D()}}B("Bad array");a=f}return a;case '"':return ia();case "-":return ha();default:return"0"<=A&& "9">=A?ha():ja()}};y=function(a,b){var c;ga=a;z=0;A=" ";c=E();D();A&&B("Syntax error");return"function"===typeof b?function e(a,c){var n,j,u=a[c];if(u&&"object"===typeof u)for(n in u)Object.prototype.hasOwnProperty.call(u,n)&&(j=e(u,n),j!==f?u[n]=j:delete u[n]);return b.call(a,c,u)}({"":c},""):c};var F;function G(a){return 10>a?"0"+a:a} function ka(a){la.lastIndex=0;return la.test(a)?'"'+a.replace(la,function(a){var c=ma[a];return"string"===typeof c?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'} function H(a,b){var c,d,e,m,s=I,n,j=b[a];j&&("object"===typeof j&&"function"===typeof j.toJSON)&&(j=j.toJSON(a));"function"===typeof J&&(j=J.call(b,a,j));switch(typeof j){case "string":return ka(j);case "number":return isFinite(j)?String(j):"null";case "boolean":case "null":return String(j);case "object":if(!j)return"null";I+=K;n=[];if("[object Array]"===Object.prototype.toString.apply(j)){m=j.length;for(c=0;c(new Date).getTime())?(a.scope=new p(a.scope),a):h},o:function(){q.l.removeItem("amazon_Login_state_cache")}}; function qa(){return window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest||"undefined"!==typeof window.XDomainRequest?g:i}function P(a,b,c,d,e,m){this.a=new Q(a,b,c);("string"!=typeof d||!d)&&v("missing or invalid path: %s",d);this.f=d;"object"==typeof e&&(e=L(e));e&&"string"!=typeof e&&v("invalid query: %s",e);this.c=e||"";"object"==typeof m&&(m=L(m));m&&"string"!=typeof m&&v("invalid fragment: %s",m);this.b=m||""} function N(a){var b=document.createElement("div");b.innerHTML="";b.firstChild.href=a;b.innerHTML=b.innerHTML;a=b.firstChild;""==a.host&&(a.href=a.href);b=a.port;if(!b||"0"==b)b=h;var c=a.pathname;c?"/"!=c[0]&&(c="/"+c):c="/";return new P(a.protocol,a.hostname,b,c,a.search.substring(1),a.href.split("#")[1]||"")}l=P.prototype;l.scheme=function(){return this.a.scheme()};l.host=function(){return this.a.host()};l.port=function(){return this.a.port()};l.path=k("f");l.h=k("c");l.g=k("b"); function pa(a){var b="http"==a.a.scheme(),a=a.a.host();return b&&("localhost"==a||"127.0.0.1"==a)}l.toString=function(){var a=this.a.toString(),a=a+this.f,a=a+(this.c?"?"+this.c:"");return a+=this.b?"#"+this.b:""};function ra(a,b){return new P(b.scheme!==f?b.scheme:a.scheme(),b.host!==f?b.host:a.host(),b.port!==f?b.port:a.port(),b.path!==f?b.path:a.path(),b.h!==f?b.h:a.h(),b.g!==f?b.g:a.g())} function Q(a,b,c){var d;("string"!=typeof a||!(d=a.match(/^(https?)(:(\/\/)?)?$/i)))&&v("missing or invalid scheme: %s",a);this.a="http"==d[1]?"http":"https";if(!(a="string"!=typeof b))if(!(a=!b))("string"!=typeof b||!b)&&v("missing or invalid input: %s",b),a=0==b.replace(/^\s+|\s+$/g,"").length;a&&v("missing or invalid host: %s",b);this.c=b;if(c&&((c+"").match(/^\d+$/)||v("invalid port: %s",c),80==c&&"http"==this.a||443==c&&"https"==this.a))c=h;this.b=c?c+"":h}var sa=/^(http|https):\/\/(.+?)(:(\d+))?$/i; Q.prototype.scheme=k("a");Q.prototype.host=k("c");Q.prototype.port=k("b");Q.prototype.toString=function(){var a;a=""+(this.a+"://");a+=this.c;return a+=this.b?":"+this.b:""};function R(a,b,c,d){return new P(a.a,a.c,a.b,b,c,d)}function ta(a){for(var b="",c=0;c=c?c:c-Math.min(Math.floor(0.1*c),300),r.G(b,c),t.C()?q.d.setItem(t.e,b.access_token,c):q.d.removeItem(t.e)):c&&q.d.removeItem(t.e);a.z(b);a=Ma;Ma=[];for(b=0;b'),c.appendChild(d));d.setAttribute("id",s);var n=document.createElement("form");m.appendChild(n);n.setAttribute("method","POST");n.setAttribute("target",s);d=ua(function(b){m.removeChild(n); var c=document.getElementById(s);c!=h&&c.parentNode!=h&&c.parentNode.removeChild(c);b==h&&(b={error:"server_error",description:"Server error."});La(a,b,i)});c=a.a;b={client_id:Y,exac:b,grant_type:"client_credentials",redirect_uri:d,response_type:c.response_type,scope:c.scope};c.state!=h&&(b.state=c.state);c.response_mode!=h&&(b.response_mode=c.response_mode);c.direct_post_uri!=h&&(b.direct_post_uri=c.direct_post_uri);c.scope_data!=h&&(b.scope_data=c.scope_data);c.optional_scope!=h&&(b.claims=c.optional_scope); c["com.amazon.oauth2.options"]!=h&&(b["com.amazon.oauth2.options"]=c["com.amazon.oauth2.options"]);n.setAttribute("action",R(U,"/ap/oa",b).toString());n.submit();return}e={error:"invalid_grant",error_description:"invalid grant"}}if(e){setTimeout(function(){a.z(e)},0);return}}Sa(a,d)}} function Sa(a,b){var c=a.a;if(c.popup){Z=g;var c=ua(function(b){Ga();La(a,b,g)}),c=Ha(a.a,c,b),d=(window.screenX!==f?window.screenX:window.screenLeft)+Math.floor(((window.outerWidth!==f?window.outerWidth:document.documentElement.clientWidth)-800)/2),e=(window.screenY!==f?window.screenY:window.screenTop)+Math.floor(((window.outerHeight!==f?window.outerHeight:document.documentElement.clientHeight)-540)/2),d=w("left=%s,top=%s,width=%s,height=%s,scrollbars=1",0>d?0:d,0>e?0:e,800,540);X=window.open(c.toString(), "amazonloginpopup",d)}else(d=a.c)||v("Missing redirectUrl for redirect flow"),c=Ha(c,N(d+""),b).toString(),window.top.location.href=c}t={m:{NorthAmerica:"NA",Europe:"EU",AsiaPacific:"APAC"},e:"amazon_Login_accessToken"};var Ta=/^[\w\-\.]+$/,Ca=/^((http|https):\/\/)?([a-z0-9\-\.]+)(:(\d+))?\/?$/i,$={ALWAYS:"always",k:"auto",NEVER:"never"},X=h,Z=i,Ma=[],Ra={F:"queued",D:"in_progress",r:"complete"},Y=f;t.v=function(){return Y};t.K=function(a){a.match(Ta)||v("invalid client ID: %s",a);Y=a}; var Ua="www.amazon.com",U=new Q("https",Ua,h),Va=new Q("https","api.amazon.com",h);t.w=function(){return Ua};t.H=function(){return Va};var Ka=i;t.O=function(a){"number"==typeof a&&(a=!!a);x("sandboxMode",a,"boolean");Ka=a};t.i=function(a){U=Ba(a);Ua=a};t.j=function(a){Va=Ba(a)}; t.N=function(a){a&&(a===t.m.Europe?(t.i("https://eu.account.amazon.com"),t.j("https://api.amazon.co.uk")):a===t.m.AsiaPacific?(t.i("https://apac.account.amazon.com"),t.j("https://api.amazon.co.jp")):(t.i("https://www.amazon.com"),t.j("https://api.amazon.com")))};var Ia="";t.L=function(a){Ia=a};var Ja="";t.M=function(a){Ja=a};t.I=function(){return U};var Wa=i;t.C=function(){return Wa}; t.P=function(a){a==h?v("missing useCookie"):"number"==typeof a?a=!!a:"boolean"!=typeof a&&v("expected useCookie to be a boolean");Wa=a};Pa.prototype.z=function(a){this.f=a;ba(this.b,a);this.q(Ra.r);for(a=0;aarguments.length&&v("authorize expects two arguments (options, next)");a&&"object"!=typeof a&&v("authorize expects options parameter to be an object");b!=h&&("function"!=typeof b&&"string"!=typeof b)&&v("authorize expects next parameter to be a function or a string");var c=ba({interactive:f,popup:g,response_type:"token",response_mode:f,delegated_requests:f,direct_post_uri:f,state:f,scope:f,scope_data:f,optional_scope:f,"com.amazon.oauth2.options":f,workflow_data:f},a||{});x("options.response_type", c.response_type,"string");c.response_mode&&x("options.response_mode",c.response_mode,"string");c.direct_post_uri&&x("options.direct_post_uri",c.direct_post_uri,"string");var d=c.delegated_requests;if(d){var e=c.response_type;(!e||"delegate"!==e)&&v("expected %s value to be %s but was %s","options.response_type","delegate",e);c.scope&&v("options.scope is not supported for delegated authorization");c.scope_data&&v("options.scope_data is not supported for delegated authorization");c.optional_scope&& v("options.optional_scope is not supported for delegated authorization");c.interactive?c.interactive!=$.ALWAYS&&v("options.interactive should be '"+$.ALWAYS+"' for delegated authorization"):c.interactive=$.ALWAYS;for(var e={},m=0;m